<%@page language="java" pageEncoding="utf-8" contentType="application/vnd.ms-excel"%>
<%@ page import="java.io.*" %>
<%@ page import="com.example.demo.util.UploadALiYunOOS" %>
<%@ page import="com.aliyun.oss.OSSClient" %>
<%@ page import="java.net.HttpURLConnection" %>
<%@ page import="java.net.URL" %>
<% 
	String path=request.getParameter("path");
	int c =path.substring(0, 1).indexOf("/");
	if(c!=-1)
		path=path.substring(1);
	UploadALiYunOOS oss = new UploadALiYunOOS();
	OSSClient ossClient =oss.creatOSSClient();
	String howPath = oss.styleQuery(ossClient,path,"style/ys320");
	oss.shutDownClient(ossClient);
	try {
		OutputStream os = response.getOutputStream();
		URL url = new URL(howPath);
		HttpURLConnection connection = (HttpURLConnection) url.openConnection();
		connection.setConnectTimeout(20000);
		connection.setReadTimeout(20000);
		connection.setRequestProperty("Referer", howPath);
		connection.setRequestProperty("Accept-Encoding", "gzip,deflate");
		connection.setRequestProperty("User-Agent","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)");
		connection.setFollowRedirects(true);
		connection.setRequestMethod("GET");
		connection.connect();

		InputStream in = connection.getInputStream();
		if (null != in) {
			int len;
			byte[] b = new byte[1024];
			while ((len = in.read(b))>0) {
				os.write(b, 0, len);

			}
			os.flush();
			in.close();
		}
		os.close();
		os=null;
		response.flushBuffer();
		out.clear();
		out = pageContext.pushBody();

	}catch(Exception e){
		e.printStackTrace();
	}
%>
